Repository navigation
[REFACTOR][llm_backend][Remove litellm and make RouteHub the default and only model-call backend] - #2789
Closed
ayaangazali wants to merge 2 commits into
Closed
[REFACTOR][llm_backend][Remove litellm and make RouteHub the default and only model-call backend]#2789ayaangazali wants to merge 2 commits into
ayaangazali wants to merge 2 commits into
Conversation
…and only model-call backend]
agent_loader imports tqdm, but swarms never declared it; it arrived through litellm. With litellm removed, a fresh install fails on "import swarms" with ModuleNotFoundError: No module named 'tqdm', which is why every test module errored at collection in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| from typing import Any | ||
|
|
||
| BACKENDS = ("routehub", "litellm") | ||
| from loguru import logger |
Contributor
Author
There was a problem hiding this comment.
No change for this one. loguru is a declared runtime dependency (pyproject.toml and requirements.txt), and 45 modules under swarms/ on master already import it the same way. Pyre's environment does not install the package's dependencies, so it cannot resolve the import anywhere; it reports it here only because this PR added the line (the same alert was answered on #2451).
The test job does install dependencies and imports this module: all 9 tests in tests/utils/test_llm_backend.py pass, and the job's 246 failures and 7 errors are the same set as master's latest run on 6967b7d, all from tests that need a live OPENAI_API_KEY.
Owner
|
i assigned this to myself, if you didn't see |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
llm_backendpicks the model-call library at import time (RouteHub when installed, litellm otherwise), and litellm is the required dependency while RouteHub is optional behindswarms[fast]. Two backends means every model-call behaviour has to hold on both.What this changes
RouteHub becomes the only model-call backend, installed by default:
litellmremoved frompyproject.tomlandrequirements.txt;routehub[fast]>=0.2.0becomes a required dependency and drops out of thefastextra.tqdmis now declared:agent_loaderimports it and it used to arrive only through litellm, so a fresh install without it failed onimport swarms.swarms/utils/llm_backend.py: the litellm branch, theBACKENDStuple, the install hints andselect_backendare gone;backend_module()always imports RouteHub. A leftoverSWARMS_LLM_BACKEND=litellmwarns once instead of switching; other values are ignored. Lazy import and the__getattr__passthrough are unchanged.swarms/utils/litellm_wrapper.py: the branch that wrote module-level settings onto litellm and the RouteHub-only guard on the vision-catalog check collapse to their RouteHub paths.cli/main.py,cli/models.py,cli/tips.py,cli/utils.py,tree_of_thoughts.py), the auto-builder prompt's model-string guidance,README.md,CLAUDE.md,SKILL.mdand.env.example(SWARMS_LLM_BACKENDentry removed).cli/models.pykeeps reading thelitellm_providerkey, because RouteHub returns the same model-info shape.tests/utils/test_llm_backend.pydrops the backend-selection suite for RouteHub-only coverage, including the leftover-litellmwarning.Verified
RouteHub 0.2.0 exposes every name the package reads (
completion,acompletion,embedding,model_list,get_model_info,get_max_tokens,encode, thesupports_*checks, provider exceptions). Full offline suite, forced-RouteHub on master vs this branch: identical results (249 failed / 2135 passed both sides: the same pre-existing live-LLM-without-key failures the unit suite carries today).Deliberately not in this PR
The
litellm_wrappermodule andLiteLLMclass rename to a backend-neutral name (with a one-release deprecated alias) is pure churn across ~55 files with no behaviour change, so it gets its own PR, as does the sweep of the 60 example files.git grep -i litellmstill names the wrapper, which the acceptance in #2781 anticipates staging.Closes #2781